---
import type { Formula } from "@type/formula";
import CraftingShaped from "./CraftingShaped.astro";
import CraftingShapeless from "./CraftingShapeless.astro";
import Blasting from "./Blasting.astro";
import Smelting from "./Smelting.astro";
import Smithing from "./Smithing.astro";
import CreditShop from "./CreditShop.astro";

export interface Props {
  formula: Formula;
}

const { formula } = Astro.props;
---

{
  (() => {
    switch (formula.type) {
      case "minecraft:crafting_shaped":
        return <CraftingShaped formula={formula} />;
      case "minecraft:crafting_shapeless":
        return <CraftingShapeless formula={formula} />;
      case "minecraft:smelting":
        return <Smelting formula={formula} />;
      case "minecraft:smithing":
        return <Smithing formula={formula} />;
      case "minecraft:blasting":
        return <Blasting formula={formula} />;
      case "creditshop":
        return <CreditShop formula={formula} />;
      default:
        return null;
    }
  })()
}
